#include "clasemasini.h"

Car* CarFactory::GetCar(char *tip) 
{
    if ( strcmp(tip, "Sedan" ) == 0) 
		 return new Sedan();
    if ( strcmp(tip, "Coupe" ) == 0) 
		 return new Coupe();
    if ( strcmp(tip, "Mini") == 0)
		 return new Mini();
 
	return new Sedan();
}


Sedan::Sedan()
{ char *c = (char*)malloc(20 * sizeof(char));
  char *t = (char*)malloc(20 * sizeof(char));
  float dim;
 
	printf("Introdu culoare:\n");
    scanf("%s", c);
	printf("\nIntrodu transmisie:\n");
	scanf("%s", t);
	printf("\nIntrodu dimensiune:\n");
	scanf("%f", &dim);

	this->SetCuloare(c);
	this->SetTransmisie(t);
	this->dimensiune=dim;
}

void Sedan::PrintCar()
{ 
	printf("Sedan\n");
	printf("culoare %s\n", this->GetCuloare());
    printf("transmisie %s\n", this->GetTransmisie());
	printf("dimensiune %f\n", this->GetDimensiune());
}


Coupe::Coupe()
{
  char *c = (char*)malloc(20 * sizeof(char));
  char *t = (char*)malloc(20 * sizeof(char));
  char *d = (char*)malloc(40 * sizeof(char));
	printf("Introdu culoare:\n");
    scanf("%s", c);
	printf("\nIntrodu transmisie:\n");
	scanf("%s", t);
	printf("\nIntrodu dotari:\n");
	scanf("%s", d);

	this->SetCuloare(c);
	this->SetTransmisie(t);
	strcpy(this->dotari,d);
}

void Coupe::PrintCar()
{   
	printf("Coupe\n");
	printf("culoare %s\n", this->GetCuloare());
    printf("transmisie %s\n", this->GetTransmisie());
    printf("dotari %s\n", this->dotari);
}

Mini::Mini()
{
  char *c = (char*)malloc(20 * sizeof(char));
  char *t = (char*)malloc(20 * sizeof(char));
  char *m = (char*)malloc(30 * sizeof(char));
	printf("Introdu culoare:\n");
    scanf("%s", c);
	printf("\nIntrodu transmisie:\n");
	scanf("%s", t);
	printf("\nIntrodu motorizare:\n");
	scanf("%s", m);

	this->SetCuloare(c);
	this->SetTransmisie(t);
	strcpy(this->motorizare,m);
}

void Mini::PrintCar()
{   printf("Mini\n");
	printf("culoare %s\n", this->GetCuloare());
    printf("transmisie %s\n", this->GetTransmisie());
    printf("motorizare %s\n", this->motorizare);
}